/*
 * OrderPushProcess.java
 * business
 *
 * Created by ChenTao on 2016/10/31.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.data.push.process;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.data.bean.Message;
import com.yidiandao.business.data.push.AbsPushProcess;
import com.yidiandao.business.ui.orderabout.orderdetail.OrderDetailActivity;

/**
 * 物流通知或者订单未支付通知
 */
public class OrderPushProcess extends AbsPushProcess {

    public OrderPushProcess(Context context, Message message, boolean isForeground) {
        super(context, message, isForeground);
    }

    @Override
    public Intent getClickNotificationJumpActivityIntent() {
        // 点击终端订单通知，去到订单详情页面
        return new Intent(mContext, OrderDetailActivity.class);
    }

    @Override
    protected void addExtraDataToNotificationClickReceiverIntent(Intent intent) {
        // 添加跳转到订单页面需要的数据信息
        intent.putExtra(Intents.EXTRA_ORDER_ID, mMessage.getOrderId());
    }

    @Override
    public void onDialogEnsureButtonClick(Message message) {
        // 去到订单页面
        OrderDetailActivity.actionStart((Activity) mContext, message.getOrderId());
        if (Message.Type.ORDER.equals(message.getType())) {
            tellServerMessageHasRead(message.getMsgId());
        }
    }
}
